package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-07-27
 * Time: 11:03
 */
public class test6 {

    public static class MyRunnable1 implements Runnable{
        @Override
        public void run() {
            System.out.println("我是Thread");
        }
    }

    public static void main(String[] args) {
        //为线程起名
        Thread t1 = new Thread(()->{
            System.out.println("我是Thread!!!");
        },"我是Thread线程");
        Runnable r = new MyRunnable1();
        //使用Runnable对象并为线程起名
        Thread t2 = new Thread(r,"我是Thread线程");
    }

}
